<div [@routerTransition]>
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title">
                    <span>工装维修台帐管理</span>
                </h3>
            </div>
            <div class="col text-right mt-3 mt-md-0"></div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                    <form class="horizontal-form" autocomplete="off">
                        <div class="m-form m-form--label-align-right">
                            <div class="row">
                                <div class="col-md-11">
                                    <div class="row align-items-center">
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="f_MaterialCode">工装编号:</label>
                                                <div class="col-8">
                                                    <input type="text" class="form-control m-input" name="f_MaterialCode"
                                                           id="f_MaterialCode" [(ngModel)]="f_MaterialCode" />
                                                </div>
                                            </div>
                                        </div>
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_TaskNum">工装名称:</label>
                                                <div class="col-8">
                                                    <input type="text" class="form-control m-input" name="Search_TaskNum"
                                                           id="Search_TaskNum" [(ngModel)]="f_MaterialName" />
                                                </div>
                                            </div>
                                        </div>
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="warehouseNameFilter">仓库:</label>
                                                <div class="col-8">
                                                    <camc-multiSelect class="float-left" id="warehouseNameFilter" [options]="roomOption" name="tabdle" [(ngModel)]="selectedWareHouse"
                                                                      [style]="{ width: '220px' }" styleClass="form-control" defaultLabel="选择仓库" maxSelectedLabels="1"
                                                                      selectedItemsLabel="已选择{0}个仓库">
                                                    </camc-multiSelect>
                                                </div>
                                            </div>
                                        </div>
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_MaterialName">数量:</label>
                                                <div class="col-8">
                                                    <camc-dropdown-auto [options]="useableOptions" name="isuseable" [(ngModel)]="isuseable"
                                                                        class="float-left width-percent-100">
                                                    </camc-dropdown-auto>
                                                </div>
                                            </div>
                                        </div>
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_DrawingNum">规格</label>
                                                <div class="col-8">
                                                    <input type="text"
                                                           class="form-control m-input"
                                                           name="Search_Specification"
                                                           id="Search_Specification"
                                                           [(ngModel)]="f_Specification" />
                                                </div>
                                            </div>
                                        </div>
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_DrawingNum">工装图号:</label>
                                                <div class="col-8">
                                                    <input type="text"
                                                           class="form-control m-input"
                                                           name="Search_TradeMark"
                                                           id="Search_TradeMark"
                                                           [(ngModel)]="f_CAL_ToolingPictureId" />
                                                </div>
                                            </div>
                                        </div>
                                        <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_DrawingNum">产品型号:</label>
                                                <div class="col-8">
                                                    <input type="text"
                                                           class="form-control m-input"
                                                           name="Search_Precision"
                                                           id="Search_Precision"
                                                           [(ngModel)]="f_CAL_ProductModel" />
                                                </div>
                                            </div>
                                        </div>
                                        <!-- <div style="width: 20%;">
                                            <div class="form-group m-form__group row">
                                                <label class="col-4 col-form-label" for="Search_DrawingNum">序列号:</label>
                                                <div class="col-8">
                                                    <input type="text"
                                                           class="form-control m-input"
                                                           name="Search_Precision"
                                                           id="Search_Precision"
                                                           [(ngModel)]="f_SeriesNum" />
                                                </div>
                                            </div>
                                        </div> -->
                                    </div>
                                    
                                </div>
                                <div class="col-md-1 m--align-right">
                                    <button (click)="getAccounts()" class="btn btn-primary m--margin-top-40" type="button">
                                        <i class="flaticon-search-1" [attr.aria-label]="l('Search')"></i>查询
                                    </button>
                                </div>
                            </div>
                        </div>
                    </form>

                    <hr />

                    <div class="row align-items-center">
                        <div class="col-md-6">
                            <h4 class="m-subheader__title">维修台帐信息</h4>
                        </div>
                        <div class="col-md-6 m--align-right">
                            <div class="btn-group m-btn-
                            " role="group" aria-label="...">
                            </div>
                        </div>

                        <div class="col-md-12 m--margin-top-20">
                            <p-table #dataTable (onLazyLoad)="getAccounts($event)" [value]="primengTableHelper.records"
                                [rows]="primengTableHelper.defaultRecordsCountPerPage" [paginator]="false" [lazy]="true"
                                [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                                [resizableColumns]="primengTableHelper.resizableColumns" selectionMode="multiple"
                                scrollHeight="{{scrollHeight}}">
                                <ng-template pTemplate="header">
                                    <tr>
                                        <th style="width: 40px">
                                            <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
                                        </th>
                                        <th style="width: 40px">
                                            序号
                                        </th>
                                        <ng-container *ngFor="let ext of extensions">
                                            <th width="{{ ext.width }}">
                                                {{ ext.title }}
                                            </th>
                                        </ng-container>
                                    </tr>
                                </ng-template>

                                <ng-template pTemplate="body" let-record="$implicit" let-i="rowIndex">
                                    <tr [pSelectableRow]="record">
                                        <td style="width: 40px">
                                            <p-tableCheckbox [value]="record"></p-tableCheckbox>
                                        </td>
                                        <td style="width: 40px">
                                            {{ i + 1 + paginator.first }}
                                        </td>
                                        <ng-container *ngFor="let ext of extensions">
                                            <ng-container [ngSwitch]="ext.formatType">
                                                <ng-container *ngSwitchCase="1">
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] | number: '1.0-0' }}
                                                    </td>
                                                </ng-container>
                                                <ng-container *ngSwitchCase="2">
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] | number: '1.2-2' }}
                                                    </td>
                                                </ng-container>
                                                <ng-container *ngSwitchCase="4">
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] | momentFormat: 'YYYY-MM-DD' }}
                                                    </td>
                                                </ng-container>
                                                <ng-container *ngSwitchDefault>
                                                    <td width="{{ ext.width }}">
                                                        {{ record[ext.key] }}
                                                    </td>
                                                </ng-container>
                                            </ng-container>
                                        </ng-container>
                                    </tr>
                                </ng-template>
                            </p-table>

                            <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                没有数据
                            </div>
                            <div class="primeng-paging-container">
                                <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                    (onPageChange)="getAccounts($event)" [totalRecords]="primengTableHelper.totalRecordsCount"
                                    [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                                </p-paginator>
                                <span class="total-records-count">
                                    {{ 'TotalRecordsCount' | localize: primengTableHelper.totalRecordsCount }}
                                </span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
